package com.kedacom.freedomLabel.initdata.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;


import com.kedacom.freedomLabel.initdata.bean.Classes;
import com.kedacom.freedomLabel.model.db.dao.IDao;

import java.util.List;

/**
 * Created by yao on 2021/3/23.
 * Describe
 */
@Dao
public interface ClassesDao extends IDao<Classes> {

    @Override
    @Query("SELECT COUNT(0) FROM Classes")
    int count();


    @Override
    @Update
    void update(Classes data);

    @Override
    @Insert(onConflict = OnConflictStrategy.FAIL)
    long save(Classes data);


    @Override
    @Insert(onConflict = OnConflictStrategy.FAIL)
    long[] save(List<Classes> data);


    @Override
    @Query("SELECT * FROM  Classes  ORDER BY classId DESC")
    List<Classes> get();

    @Override
    @Query("SELECT * FROM Classes WHERE className LIKE  '%' || :param || '%'  ")
    List<Classes> get(String param);

    @Override
    @Query("SELECT * FROM Classes WHERE className=:param1 and className LIKE :param2")
    List<Classes> get(String param1, String param2);

    @Override
    @Delete
    void delete(Classes data);

    @Override
    @Query("DELETE FROM Classes")
    void delete();

    @Override
    @Query("DELETE FROM Classes WHERE classId=:param ")
    void delete(String param);

//    @Override
//    @Query("SELECT * FROM Classes")
//    List<Classes> getAllClasses();
//
//    @Override
//    @Query("SELECT * FROM Classes WHERE classId=:classId")
//    Classes getAllClassesByName(String classId);
//    @Override
//    @Insert
//    void insert(List<Classes> classesList);
//    @Override
//    @Delete
//    void delete(List<Classes> classesList);
}
